<script>
lang.nav_name = '导航名称';
lang.nav_link = '导航链接';
lang.nav_alias = '英文目录';
</script>

<script>
$(function(){
	if($("#pid").val()>0) {
		$.ajax({
			type: "GET",
			url: "{:U('nav/ajax_get_cate')}",
			data: { id : $("#pid").val() },
			success: function(data) {
				$("#cate").val(data);
			},
			complete: function() {},
			error: function() {}
		})
	}
	$("#cate").change(function() {
		var cate = $(this).val();
		$("#pid").load("{:U('nav/ajax_load_pids?cate=')}"+cate);
	});
});
</script>

<!--导航添加-->
<div class="dialog_content">
	<form id="info_form" name="info_form" action="{:u('nav/add')}" method="post">
    <table width="100%" class="table_form" style="margin-bottom:10px">
    	<tr>
          <th width="100">导航类别 :</th>
          <td>
          	<select name="cate" id="cate">
            	<option value="">--请选择类别--</option>
            	{$select_cates}
            </select>
          </td>
        </tr>
    	<tr>
          <th width="100">上级导航 :</th>
          <td>
          	<select name="pid" id="pid">
            	<option value="0">作为一级导航</option>
            	{$select_navs}
            </select>
          </td>
        </tr>
        <tr>
          <th>{:L('nav_name')} :</th>
          <td><input type="text" name="name" id="name" class="input-text"></td>
        </tr>
        <tr>
          <th>别名 :</th>
          <td><input type="text" name="alias" id="alias" class="input-text"></td>
        </tr>
        <tr>
          <th>英文目录 :</th>
          <td><input type="text" name="dir" id="dir" class="input-text"></td>
        </tr>
        <tr>
          <th>链接 :</th>
          <td><input type="text" name="link" id="link" class="input-text" size="35"></td>
        </tr>
        <tr>
          <th>{:L('remark')} :</th>
          <td><textarea name="remark" id="remark" cols="40" rows="2"></textarea></td>
        </tr>
        <tr>
          <th>是否显示 :</th>
          <td>
            <label><input type="radio" name="status" class="radio_style" value="1" checked="checked"> {:L('yes')}&nbsp;&nbsp;</label>
            <label><input type="radio" name="status" class="radio_style" value="0"> {:L('no')}</label>
          </td>
        </tr>
        <tr>
            <th>是否新窗口 :</th>
            <td>
                <label><input type="radio" name="target" class="radio_style" value="1" checked="checked"> {:L('yes')}&nbsp;&nbsp;</label>
                <label><input type="radio" name="target" class="radio_style" value="0"> {:L('no')}</label>
            </td>
        </tr>
        <tr>
            <th>是否推荐 :</th>
            <td>
                <label><input type="radio" name="istop" class="radio_style" value="1"> {:L('yes')}&nbsp;&nbsp;</label>
                <label><input type="radio" name="istop" class="radio_style" value="0" checked="checked"> {:L('no')}</label>
            </td>
        </tr>
    </table>
    </form>
</div>

<script>
$(function(){
	$("#cate").formValidator({onshow:"请选择类别",onfocus:"请选择类别"}).inputValidator({min:1,onerror:"请选择类别"});
	$("#name").formValidator({ onshow:lang.please_input+lang.nav_name, onfocus:lang.please_input+lang.nav_name, oncorrect:lang.input_right}).inputValidator({ min:1, onerror:lang.please_input+lang.nav_name});
	$("#dir").formValidator({ onshow:lang.please_input+lang.nav_alias, onfocus:lang.please_input+lang.nav_alias, oncorrect:lang.input_right}).inputValidator({ min:0, onerror:lang.please_input+lang.nav_alias}).regexValidator({ regexp:'^[a-zA-Z_]*\\w*$', datatype:'string' });
	$("#link").formValidator({ onshow:lang.please_input+lang.nav_link, onfocus:lang.please_input+lang.nav_link, oncorrect:lang.input_right}).inputValidator({ min:0, onerror:lang.please_input+lang.nav_link});
})
</script>